from json_parse import parse_action

str1 = '''
{
    "content": {
        "result": {
            "sid": "cid6f183db5@ch00da0df9da2b010001",
            "intent": {
                "sid": "cid6f183db5@ch00da0df9da2b010001",
                "text": "你在干嘛",
                "status": 0,
                "score": 0.898123025894165,
                "answer": {
                    "answerType": "openQA",
                    "topicID": "32184198872170545",
                    "text": "发呆。",
                    "question": {
                        "question_ws": "你/NP//  在/UU//  干嘛/VI//",
                        "question": "你在干嘛"
                    },
                    "type": "T",
                    "emotion": "default"
                },
                "cid": "cid6f183db5@ch00da0df9cf96000000",
                "rc": 0,
                "operation": "ANSWER",
                "engine_time": 0.001,
                "service": "openQA",
                "man_intv": "",
                "uuid": "atn003b46f0@ch5c040df9da2c6f1d01",
                "no_nlu_result": 1,
                "array_index": 0
            }
        },
        "arg2": 0,
        "eventType": 1,
        "arg1": 0,
        "info": {
            "data": [
                {
                    "content": [
                        {
                            "dtf": "json",
                            "cnt_id": "0",
                            "dte": "utf8"
                        }
                    ],
                    "params": {
                        "rstid": 1,
                        "sub": "nlp",
                        "lrst": false
                    }
                }
            ]
        }
    },
    "type": "aiui_event"
}
'''
str2 = '''
{
    "content": {
        "result": {
            "sid": "cid6f183db5@ch00da0df9da7d010003",
            "intent": {
                "sid": "cid6f183db5@ch00da0df9da7d010003",
                "operation": "ANSWER",
                "engine_time": 0.001,
                "text": "今天几号",
                "state": null,
                "service": "datetime",
                "score": 1,
                "answer": {
                    "type": "T",
                    "text": "今天是2018年03月06日 戊戌年正月十九 星期二"
                },
                "uuid": "atn003b45b6@ch5d090df9da7f6f2001",
                "cid": "cid6f183db5@ch00da0df9cf96000000",
                "rc": 0,
                "match_info": {
                    "value": "----",
                    "type": "gparser_path"
                },
                "array_index": 0
            }
        },
        "arg2": 0,
        "eventType": 1,
        "arg1": 0,
        "info": {
            "data": [
                {
                    "content": [
                        {
                            "dtf": "json",
                            "cnt_id": "0",
                            "dte": "utf8"
                        }
                    ],
                    "params": {
                        "rstid": 1,
                        "sub": "nlp",
                        "lrst": false
                    }
                }
            ]
        }
    },
    "type": "aiui_event"
}
'''
str3 = '''
{
    "content": {
        "result": {
            "sid": "cid6f183db5@ch00da0df9de6901000c",
            "intent": {
                "sid": "cid6f183db5@ch00da0df9de6901000c",
                "text": "嘴动一下",
                "intentType": "custom",
                "vendor": "YUJIAO",
                "query": "嘴动一下",
                "state": null,
                "semantic": [
                    {
                        "score": 1,
                        "entrypoint": "ent",
                        "intent": "general_action",
                        "slots": [
                            {
                                "value": "嘴",
                                "normValue": "嘴",
                                "end": 1,
                                "name": "position",
                                "begin": 0
                            }
                        ]
                    }
                ],
                "cid": "cid6f183db5@ch00da0df9cf96000000",
                "rc": 0,
                "version": "5.0",
                "category": "YUJIAO.robot_action",
                "nlis": "true",
                "query_ws": "嘴/NQ//  动/VI//  一/NM//  下/ADD//",
                "service": "YUJIAO.robot_action",
                "uuid": "atn003b7530@ch5c040df9de6b6f1d01"
            }
        },
        "arg2": 0,
        "eventType": 1,
        "arg1": 0,
        "info": {
            "data": [
                {
                    "content": [
                        {
                            "dtf": "json",
                            "cnt_id": "0",
                            "dte": "utf8"
                        }
                    ],
                    "params": {
                        "rstid": 1,
                        "sub": "nlp",
                        "lrst": false
                    }
                }
            ]
        }
    },
    "type": "aiui_event"
}
'''
# print(len(str1))
# print(len(str2))

print(parse_action(str1))
print(parse_action(str2))
print(parse_action(str3))
print(isinstance(str1, str))
